﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IBLL;
using Model;
using DALFAC;

namespace BLL
{
    public class AlbumBLL:IAlbumBLL
    {
        //根据传入的userId得到用户的相册列表
        //没有则返回null
        public List<Model.Album> getAlbumLists(int userId)
        {
             DAL.AlbumDAL albumOperator = (DAL.AlbumDAL)DALFAC.DataAccess.CreateAlbum();
             List<Model.Album> albumList = albumOperator.getAllAlbum(userId);

             if (albumList != null)
             {
                 return albumList;
             }
             else {
                 return null;
             }

        }

        //根据传入的albumId得到缩略图
        //没有则为默认
        //Byte[] getImgLow(int albumId) {
        //    DAL.AlbumDAL albumOperator = (DAL.AlbumDAL)DALFAC.DataAccess.CreateAlbum();
        //    int photoCount = albumOperator.getCount(albumId);
            
        //}

        //创建相册
        //成功返回true，否则false
        public bool createAlbum(Model.Album album)
        {
            bool validator = false;
            DAL.AlbumDAL albumOperator = (DAL.AlbumDAL)DALFAC.DataAccess.CreateAlbum();
            validator = albumOperator.Add(album);
            return validator;
        }

        //修改相册
        //成功返回true，否则false
        public bool modifyAlbum(Model.Album album)
        {
            bool validator = false;
            DAL.AlbumDAL albumOperator = (DAL.AlbumDAL)DALFAC.DataAccess.CreateAlbum();
            validator = albumOperator.Update(album);
            return validator;
        }

        //删除相册
        //成功返回true，否则false
        public bool deleteAlbum(int albumId)
        {
            bool validator = false;
            DAL.AlbumDAL albumOperator = (DAL.AlbumDAL)DALFAC.DataAccess.CreateAlbum();
            validator = albumOperator.userDelete(albumId);
            return validator;
        }

        //分享相册
        //分享相册会出现在关注者的关注动态上
        //bool shareAlbum(Model.Album album);
    }
}
